#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import os
from typing import Optional
from dotenv import load_dotenv

# 加载.env文件
load_dotenv()

class Settings:
    """应用配置设置"""
    
    # 基础配置
    BASE_URL: str = os.getenv("BASE_URL", "http://127.0.0.1:5000")

    
    MYSQL_HOST: str = os.getenv("MYSQL_HOST", "192.168.253.41")
    MYSQL_PORT: int = int(os.getenv("MYSQL_PORT", 3306))
    MYSQL_USER: str = os.getenv("MYSQL_USER", "root")
    MYSQL_PASSWORD: str = os.getenv("MYSQL_PASSWORD", "123456")
    MYSQL_DATABASE: str = os.getenv("MYSQL_DATABASE", "nvr_test")

    # ONES API配置
    ONES_BASE_URL: str = os.getenv("ONES_BASE_URL", "https://sz.ones.cn")
    ONES_USER_ID: str = os.getenv("ONES_USER_ID", "K5uAS5Nz")
    ONES_TEAM_UUID: str = os.getenv("ONES_TEAM_UUID", "Tuq7N74j")
    ONES_ORG_UUID: str = os.getenv("ONES_ORG_UUID", "67jG3j67")
    ONES_AUTH_TOKEN: str = os.getenv("ONES_AUTH_TOKEN", "eyJhbGciOiJSUzI1NiIsImtpZCI6ImVhNWYwZDJhLTk4NmYtNGUyNC01YTFmLWQyMDllYWQ2YTIwNCIsInR5cCI6IkpXVCJ9.eyJhdWQiOlsiZGVmYXVsdCJdLCJjbGllbnRfaW5mbyI6eyJjbGllbnRfaXAiOiIxMTMuODcuMTYyLjEwNCJ9LCJleHAiOjE3NjQwNDIzMjgsImlhdCI6MTc0ODQ5MDAyOCwianRpIjoiMzI4MTc4OTItYjlhOS00MTFiLTU4ZjItYjMyNzcwODFkMzhkIiwibG9naW5fdGltZSI6MTc0ODQ5MDMyODkyMSwibmJmIjoxNzQ4NDkwMDI4LCJvcmdfdXNlcl91dWlkIjoiSzV1QVM1TnoiLCJvcmdfdXVpZCI6IjY3akczajY3IiwicmVnaW9uX3V1aWQiOiJkZWZhdWx0Iiwic2NvcGVzIjpbIm9wZW5pZCIsIm9mZmxpbmVfYWNjZXNzIiwibGVnYWN5Iiwib25lczpvcmc6ZGVmYXVsdDo2N2pHM2o2NzpLNXVBUzVOeiJdLCJzaWQiOiI5M2JhNGUyZi1lNWMwLTQ4MjItNjI4Ni0zMTQzN2Y4YTdhODUiLCJzdWIiOiJORFZUQXNySDpkZWZhdWx0OjY3akczajY3Oks1dUFTNU56In0.RL-p1spZrA9E3dWTWWapy_NU49uVLZO3S7aF64avuUXzvZFQFJKknrryH3qtJNjuRAMn8QVVlvLYthc3PtGV4DppEWbz_PmVIwlPT51OKh50FJr9xdvFy_wzlH_Q2k_VFJsnphxeTuc7ZM6f8x-GZOp3bs3T7-OFzz2bLoIyc_1g7S07cYh6MNGQOyMiwCaUBcspfxrhSe23Vay_IW4ziMa9KJox6KHlA7oZjjWJUKCGrlx1fk2RvCmOxXuRjnfs2jK7GoIHSx-OgW5BS3gYz6sjmXdXF6dLGE13UfJU4eOiQE4ImFuZylTwHb_kG47yZwa_VH_rpvnWHHhikyT25A")
    
    # 日志配置
    LOG_LEVEL: str = os.getenv("LOG_LEVEL", "INFO")
    
    # 环境配置
    ENVIRONMENT: str = os.getenv("ENVIRONMENT", "development")
    
    @property
    def is_development(self) -> bool:
        """是否为开发环境"""
        return self.ENVIRONMENT.lower() == "development"
    
    @property
    def is_production(self) -> bool:
        """是否为生产环境"""
        return self.ENVIRONMENT.lower() == "production"

# 全局设置实例
settings = Settings() 